{% extends 'IcsocUIBundle::page.html.twig' %}
{% from 'IcsocUIBundle:Macro:grid.html.twig' import gridWidth,gridNav,gridConfig %}
{% block stylesheet %}
    {{ parent() }}
    {% stylesheets
    '@jqgird_css'
    '@gritter_css'
    filter='cssrewrite' filter='uglifycss'
    %}
    <link rel="stylesheet" href="{{ asset_url }}" />
    {% endstylesheets %}
{% endblock %}

{% block content %}
    <table id="grid-table"></table>
    <div id="grid-pager"></div>
{% endblock %}
{% block footer %}
    {% javascripts
        '@jqgird_js'
        '@gritter_js'
        filter='uglifyjs'
    %}
    <script src="{{ asset_url }}"></script>
    {% endjavascripts %}
    <script type="text/javascript">
        jQuery(function($) {
            {{ gridWidth() }}
            jQuery(grid_selector).jqGrid({
                url: "{{ path('icsoc_menu_homepage', {'flag':'1'}) }}",  //数据；
                colNames:[' ', 'ID', '{{ 'Menu name'|trans }} ','{{ 'Menu url'|trans }}','{{ 'Weight value'|trans }}','{{ 'Help documentation'|trans }}','{{ 'Whether you need to show'|trans }}','{{ 'Menu icon'|trans }}'],  //列显示名称，是一个数组对象
                colModel:[
                    {name:'myac',index:'', width:80, fixed:true, sortable:false, resize:false,
                        formatter:'actions',
                        formatoptions:{
                            keys:true,
                            editbutton:true,
                            editformbutton: true,
                            delOptions:{recreateForm: true, beforeShowForm:beforeDeleteCallback, afterSubmit:afterDeleteCallback,left:540,top:206},
                            editOptions:{width: "0",height: "0", jqModal:false, beforeShowForm:beforeEditCallback }
                        }
                    },
                    {name:'id',index:'id', editable: true, sortable:false},
                    {name:'menu_text',index:'menu_text', editable:true, sortable:false},
                    {name:'menu_url',index:'menu_url',editable:true, sortable:false },
                    {name:'sort_weight',index:'sortWeight', editable:true, sortable:false },
                    {name:'help_url',index:'help_url', editable:true, sortable:false },
                    {name:'is_show',index:'is_show', editable:true, sortable:false,formatter:function(cell,opt,row){
                        return row.is_show == 1 ? '{{ 'yes'|trans }}' : '{{ 'no'|trans }}';
                    } },
                    {name:'menu_icon',index:'menu_icon', sortable:false,formatter:function(cellvalue, options, rowObject){
                        return '<i class="menu-icon fa '+rowObject.menu_icon+' bigger-230"></i>';
                    }}
                ],
                 {{ gridConfig(1, 1000) }}
                autowidth:false,
                editurl: "{{ path('icsoc_menu_menu_del') }}",//nothing is saved 定义对form编辑时的url
                caption: "{{ 'Menu list'|trans }}" //表格名称
            });
            {{ gridNav(false,false,true,false,true,true,path('icsoc_menu_ment_new'),path('icsoc_menu_jqgrid_operedit')) }}
        });
    </script>
{% endblock %}